UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ct/gyBKOooDrjcVO4OfuSqNodnGKiJOFs01jjZT/i2s=' 
WHERE 
  key_id = '6423caf5462e7d4461fa3935cc4fd9144c46b1162b1c348330a4ac982acf4d9e' 
  AND (
    token = 'ct/gyBKOooDrjcVO4OfuSqNodnGKiJOFs01jjZT/i2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038