UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i0rJzUR2LxrtqptYy4ClYLi4A2nKjqMEFfjQStrM4ow='
WHERE
key_id = '8d5d83547001b0b5171abb50ef256af2ed6ade3d6f70a62b67a8fce3dfbcc9c7'
AND (
token = 'i0rJzUR2LxrtqptYy4ClYLi4A2nKjqMEFfjQStrM4ow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)