UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zB0NHzbuavakra2EemmsYSImY/0BOv5zigzkYx0s/B0=' 
WHERE 
  key_id = '40bbf4f1f0180fa8d7060bfd5017d7abc0c5983155feffd2accb95b0392b9008' 
  AND (
    token = 'zB0NHzbuavakra2EemmsYSImY/0BOv5zigzkYx0s/B0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038