UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3eW0jTysUjtTHZxndhZ4C1/Hcj7SL0JwkEU87O2OZW4='
WHERE
key_id = 'c8b2bf8514f1fd36c7500b379fa4a8a28270f9a06be705d377b985dab356dd41'
AND (
token = '3eW0jTysUjtTHZxndhZ4C1/Hcj7SL0JwkEU87O2OZW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)