UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y07ToUkqhwXGZNgoH3Y3ruFNU3XtmciWogjkRc1qUM8='
WHERE
key_id = 'c687b58bdf56348fd6afff3a4922657cdb109fb68e64a77b8e56b233015ddbcc'
AND (
token = 'Y07ToUkqhwXGZNgoH3Y3ruFNU3XtmciWogjkRc1qUM8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)