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