UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fDAotSMzcvsPBncfx9GSUBgY89xJ1kVh+Lx85WyPVHY=' 
WHERE 
  key_id = '6d66f7c881d8fe22797efadf26ac0045ba8fff78f933befe07f6ad455077d7d6' 
  AND (
    token = 'fDAotSMzcvsPBncfx9GSUBgY89xJ1kVh+Lx85WyPVHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017