UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZueFnfiLAK0tk0b8017TOy88rOWOFiqMG0G/qTD4aj4='
WHERE
key_id = 'e11483f117808e7d3e64cc3b7b56751d6eec50ab0d2bd5b1e03e3545ee7f368b'
AND (
token = 'ZueFnfiLAK0tk0b8017TOy88rOWOFiqMG0G/qTD4aj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)