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