UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j7SFr5zllqhlT5WUuF6ERaLyrMnzGpGFOBE/cLSOZnk='
WHERE
key_id = 'e8bae504a0fdf743072b39a03c1641b5d09d62db664ecbae16eb0e45c336ff2e'
AND (
token = 'j7SFr5zllqhlT5WUuF6ERaLyrMnzGpGFOBE/cLSOZnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)