UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rIYUes/v+kf96OMkYl5/4WIfT8GJk03FY9QrhPzwBmc=' 
WHERE 
  key_id = '4f658cc05652097a3de92afb3d5e2b1e70c03ca15e9e17e3b4568529bf969717' 
  AND (
    token = 'rIYUes/v+kf96OMkYl5/4WIfT8GJk03FY9QrhPzwBmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029