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