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