UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uQAXc3GDZXyaS19EDiGPTo0YJ03lk0sMbACVKF5lCjY='
WHERE
key_id = '6d9ead3db3228f119bf48fd59f8667226ce1374792b3aaba92f9199a56f03390'
AND (
token = 'uQAXc3GDZXyaS19EDiGPTo0YJ03lk0sMbACVKF5lCjY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)