UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YbEorOQcFO4KzhK+8Y9v7MrUE3fIVGqkMWPkduclLMc=' 
WHERE 
  key_id = '06e1b88dd9efa6028348eebfb99734e0c3d1123af4184a6fea010511fa5b0822' 
  AND (
    token = 'YbEorOQcFO4KzhK+8Y9v7MrUE3fIVGqkMWPkduclLMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025