UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'baNgsu1nUApi/79HczkcenBsVfddah0Fe+uh0S18cB4='
WHERE
key_id = '4c48e0e6b919522947661e8ed03acdfd23df2b871b046c79f01ec635383a2d0e'
AND (
token = 'baNgsu1nUApi/79HczkcenBsVfddah0Fe+uh0S18cB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)