UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gyo2dV3PPnSuAXIksqXuPcrAYU3qcBqh+ffMrwB1HBs=' 
WHERE 
  key_id = '7371f2eb8d3fe4075d7b6670725051d13969ebd104281f3d1a22dfd76986f817' 
  AND (
    token = 'Gyo2dV3PPnSuAXIksqXuPcrAYU3qcBqh+ffMrwB1HBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035