UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HoTN0jidcKtq7TUUCt1knKB3I0A+qQ6T4Xe1RP7Fs7M=' 
WHERE 
  key_id = '853cd117c562f6ced0b68ae636c11caf56b88fd56d1bce49f66c106425bbcea7' 
  AND (
    token = 'HoTN0jidcKtq7TUUCt1knKB3I0A+qQ6T4Xe1RP7Fs7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032