UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1pnZ6U6r5YTIj/MEGH6z6YA/5eU+kGSQ+7s+H++eqoU=' 
WHERE 
  key_id = '38ecfc2be65740e5532bab486218b98201491138de1666ffa902a8804fe66e3f' 
  AND (
    token = '1pnZ6U6r5YTIj/MEGH6z6YA/5eU+kGSQ+7s+H++eqoU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022