UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ADV1mF72F2ASP/2Lu4ViTZDuohlN1RSkYF4Qosxw+x4=' 
WHERE 
  key_id = 'a174defd0280ee1eb8afa2a45cf36c78a22c75938f264f9d78b03bb3bc7841f1' 
  AND (
    token = 'ADV1mF72F2ASP/2Lu4ViTZDuohlN1RSkYF4Qosxw+x4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018