UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NgjIXE0q8OveAiGA6KHcI7EW6L1dDh6YTE6BuuEAuzA='
WHERE
key_id = '519b82a4ae527f880564efe95398333c0ff35726c28a5c36d23e575b0bed27c4'
AND (
token = 'NgjIXE0q8OveAiGA6KHcI7EW6L1dDh6YTE6BuuEAuzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)