UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LqrfLX+D87b1KAi8kB3SYgyEwGCxOKKa3oAAh4uNEsU='
WHERE
key_id = '8ffba736aba57203d549d6384ad36f3583dc3a0c9a0032d12c441a21a853f30f'
AND (
token = 'LqrfLX+D87b1KAi8kB3SYgyEwGCxOKKa3oAAh4uNEsU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)