UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y1XaQO+uOFAnAmVKshFrSsqHVB26YjFM9M6X5nOv2OA=' 
WHERE 
  key_id = '6cf788f044bc09d14c4bb41254b212e2852d78c15cfde344180ca62a5c47fc55' 
  AND (
    token = 'y1XaQO+uOFAnAmVKshFrSsqHVB26YjFM9M6X5nOv2OA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016