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