UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6ybxOe0AY4kUJ+IC6xxX/krVyTFGiTAsN6zDuZJ2Y8M=' 
WHERE 
  key_id = '21498b2579f1e9c6ff7ace6936c2dfad2664a93f31e1643ef75885e9a21af672' 
  AND (
    token = '6ybxOe0AY4kUJ+IC6xxX/krVyTFGiTAsN6zDuZJ2Y8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040