UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qyBGz6x13/aZ+axgEV4/suKb7DI1Utk1fqo6cRk2Wls='
WHERE
key_id = 'c1a248d90ca0502eb218a2e33c520773b5c14d0262ddd60606b35a9172e35983'
AND (
token = 'qyBGz6x13/aZ+axgEV4/suKb7DI1Utk1fqo6cRk2Wls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)