UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n1+4xrPHdbrpyVmbgo9rIArQ5PZfBXrwbWMkUd6lAuU='
WHERE
key_id = '1aead842411f3bb29a19bfc2a13f789242f0a939911f8909533b51326b1d294b'
AND (
token = 'n1+4xrPHdbrpyVmbgo9rIArQ5PZfBXrwbWMkUd6lAuU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)