UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lo1TE1sauhyVgX4yeX3NPgvj0Om8G4E+EX2xtlugE8A=' 
WHERE 
  key_id = '5bd170eefc18ec21fe1ae3aab85d07e6bc24390d9e098756769aeb7a484c87f0' 
  AND (
    token = 'lo1TE1sauhyVgX4yeX3NPgvj0Om8G4E+EX2xtlugE8A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038