UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Glw3++KEoKPS70qa1U5vAkuuabWQA3BeGYRr8SYHFPQ='
WHERE
key_id = 'b4c644f9c7838a6ae8322b5e3ee9627d65c576edd5383e1884251d416ef3c64b'
AND (
token = 'Glw3++KEoKPS70qa1U5vAkuuabWQA3BeGYRr8SYHFPQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)