UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hrkqeMcDagdDlKM0AOyEbrXjUjbupnQHx1/L6pqoXnM='
WHERE
key_id = 'fcc161b1352bed337bc2419dd166f56bca69f5714874996e01a482f71a98ba68'
AND (
token = 'hrkqeMcDagdDlKM0AOyEbrXjUjbupnQHx1/L6pqoXnM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)