UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'spgxPwmS3G6CikyBCQLknhfoSWEpAlL9b2yHeWsfsuA='
WHERE
key_id = 'a9cca696052ce8af1e75ad9e400be75a72f9c21898001ef1eca9a38bb1e37136'
AND (
token = 'spgxPwmS3G6CikyBCQLknhfoSWEpAlL9b2yHeWsfsuA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)