UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2kTCc5FFdy2h1NmIV81rKg5MS9INAgv1z8NPNBxv0a0='
WHERE
key_id = 'a091db07f189a361843b7638bab23b87bba716cfbb247a9510ff652160e93dd1'
AND (
token = '2kTCc5FFdy2h1NmIV81rKg5MS9INAgv1z8NPNBxv0a0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)