UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rgXF1ruNs+kqeYACphf8o7LvInrrrmA0yIUA4I/I9O4=' 
WHERE 
  key_id = 'd90db926dc46c18cef4b74334e16121c96bd805984579819c93c0a5bb33db04b' 
  AND (
    token = 'rgXF1ruNs+kqeYACphf8o7LvInrrrmA0yIUA4I/I9O4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031